Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

format-message-generate-id

Package Overview
Dependencies
Maintainers
4
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

format-message-generate-id

Generate a message id from the default message pattern

  • 6.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

format-message-generate-id

Generate a message id from the default message pattern

npm Version JS Standard Style MIT License

A small collection of helper functions for use in format-message, to generate a message id based on the default message pattern.

Quick Examples

npm install format-message-generate-id --save

var formatMessage = require('format-message');
formatMessage.setup({
  generateId: require('format-message-generate-id/underscored_crc32')
});
import formatMessage from 'format-message'
import generate from 'format-message-generate-id'

formatMessage.setup({
  generateId: generate.normalized
})

API

literal(pattern)

Simply returns the pattern passed in.

normalized(pattern)

Normalizes insignificant whitespace within ICU placeholder syntax. This requires parsing and pretty-printing the message pattern, and an invalid message will cause an error to be thrown.

underscored(pattern)

After normalizing the message pattern, a slug is generated with underscores replacing symbols and whitespace.

underscored_crc32(pattern)

In addition to generating a slug, a crc32 checksum is calculated from the normalized pattern and appended to the result.

License

This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.

Keywords

FAQs

Package last updated on 17 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc